package org.september.pisces.user.permission.entity;

import org.september.smartdao.anno.AutoIncrease;
import org.september.smartdao.anno.Entity;
import org.september.smartdao.anno.Id;
import org.september.smartdao.common.BaseEntity;
import org.springframework.util.StringUtils;

import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsAutoIncrement;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsKey;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;

import jakarta.validation.constraints.Size;

/**
 *
 **/
@Entity
@Table(name = "department")
public class Department extends BaseEntity{

    /**
     */
    @Id
    @AutoIncrease
    @Column(name = "id")
    @IsKey
    @IsAutoIncrement
    private Long id;

    /**
     * 部门名称
     */
    @Column(name = "name")
    @Size(max = 64)
    private String name;

    /**
     * 部门描述
     */
    @Size(max = 256)
    @Column(name = "descb", comment = "部门描述")
    private String descb;

    /**
     * 部门编码
     */
    @Size(max = 32)
    @Column(name = "code", comment = "部门编码", length = 32, isNull = false)
    private String code;

    private transient String parent;
    
    @Column(name = "parent_id")
    private Long parentId;
    
    @Column(name = "full_parent_id")
    private String fullParentId;
    
    @Column(name = "station_ids")
    private String stationIds;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescb() {
		return descb;
	}

	public void setDescb(String descb) {
		this.descb = descb;
	}

	public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

	public String getParent() {
		return parent;
	}

	public void setParent(String parent) {
		this.parent = parent;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public String getFullParentId() {
		return fullParentId;
	}

	public void setFullParentId(String fullParentId) {
		this.fullParentId = fullParentId;
	}

	public String getStationIds() {
		return stationIds;
	}

	public void setStationIds(String stationIds) {
		this.stationIds = stationIds;
	}

	public String getFullId() {
		if(StringUtils.hasText(this.getFullParentId())) {
			return this.getFullParentId()+"-"+this.getId();
		}else {
			return this.getId()+"";
		}
	}
}
